package model

import (
	"0227zk/common/initialize"
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(20);not null;index:ip_idx comment:'账号'"`
	Password string `gorm:"type:varchar(20);not null;index:ip_idx comment:'密码'"`
}

func (u User) GetUsername(username string) (user *User, err error) {
	err = initialize.DB.Where("username=?", username).Take(&user).Error
	if err != nil {
		return nil, err
	}
	return
}

func (u User) UserList() (interface{}, interface{}) {
	return nil, nil
}
